from django.contrib import admin

from articles.models import Article, Collect, Comment


# Register your models here.
class ArticleAdmin(admin.ModelAdmin):
    list_display = ('id', 'user', 'content', 'create_time', 'is_active', 'is_show')
    list_filter = ('user', 'create_time', 'is_active', 'is_show')
    search_fields = ('user', 'content')
    list_per_page = 10
    ordering = ('-create_time',)
    actions_on_top = True
    actions_on_bottom = True



admin.site.register(Article, ArticleAdmin)

class CollectAdmin(admin.ModelAdmin):
    list_display = ('id', 'article', 'user')
    list_filter = ('article', 'user')
    search_fields = ('article', 'user')
    list_per_page = 10
    ordering = ('-id',)
    actions_on_top = True
    actions_on_bottom = True


admin.site.register(Collect, CollectAdmin)


class CommentAdmin(admin.ModelAdmin):
    list_display = ('id', 'article', 'user', 'content', 'create_time', 'is_active')
    list_filter = ('article', 'user', 'create_time', 'is_active')
    search_fields = ('article', 'user', 'content')
    list_per_page = 10
    ordering = ('-create_time',)
    actions_on_top = True
    actions_on_bottom = True


admin.site.register(Comment, CommentAdmin)